package com.example.kingdee.jstSync;

import com.example.kingdee.dto.SyncDto;
import com.example.kingdee.exception.ProcedureException;
import com.example.kingdee.jstSync.impl.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class JstCreateBillFactory {

    @Autowired
    private JstPurSyncImpl jstPurSync;
    @Autowired
    private JstAppointMenTinImpl jstAppointMenTin;
    @Autowired
    private JstPurSyncInImpl jstPurSyncIn;
    @Autowired
    private JstSalOutSyncImpl jstSalOutSync;
    @Autowired
    private JstSalOrderUploadImpl jstSalOrder;
    @Autowired
    private JstSalOrderSyncImpl jstSalOrderSync;
    @Autowired
    private JstReFundSyncImpl jstReFundSync;

    public JstSyncAbstract createObject(SyncDto syncDto){
        switch (syncDto.getSyncType()){
            case "采购订单同步" : {
                return jstPurSync;
            }
            case "预约入库上传" : {
                return jstAppointMenTin;
            }
            case "采购入库同步" : {
                return jstPurSyncIn;
            }
            case "销售出库同步" : {
                return jstSalOutSync;
            }
            case "销售订单上传" : {
                return jstSalOrder;
            }
            case "销售订单同步" : {
                return jstSalOrderSync;
            }
            case "售后订单处理" : {
                return jstReFundSync;
            }
            default: throw new ProcedureException("请传入正确的单据类型", syncDto);
        }
    }
}
